<?php

if (!defined('TIMESTARTPAGE')) 
{
    define('TIMESTARTPAGE', microtime(true));
}
//load config
include "../includes/gpc_function.php";
@include "../includes/config/config.php";
//create object db
include "../includes/class_mysql.php";

$user   = gpc_getStringPost('User');
$pass   = gpc_getStringPost('Pass');

$db_host       = gpc_getStringPost('Db_Host');
$db_name       = gpc_getStringPost('Db_Name');
$db_username   = gpc_getStringPost('Db_User');
$db_password   = gpc_getStringPost('Db_Pass');
$File_Path     = gpc_getStringPost('File_Path');

$passMd5       = "74a79df60b0bece2970ffcfc1c8af53e";

if($user=="pntrinh" && md5($pass)==$passMd5 && !empty($db_host) && !empty($db_name) && !empty($File_Path))
{
    $data   = file_get_contents($File_Path);
    if(empty($data))
    {
        echo 'not data';
    }else
    {
        $dbsql = new mysqlclass($db_host,$db_username,$db_password,$db_name);
        $data=preg_replace("((--)(.*))","",$data);
        $dbsql->Restore($data);
        echo 'ok';exit;
    }
}       
  
?>
<form method="post">
<table>
    <tr>
        <td>User</td>
        <td><input name="User" /></td>
    </tr>
    <tr>
        <td>Pass</td>
        <td><input name="Pass" type="password" /></td>
    </tr>
    
    
    <tr>
        <td>Db Host</td>
        <td><input name="Db_Host" value="localhost" /></td>
    </tr>
    <tr>
        <td>Db Name</td>
        <td><input name="Db_Name" /></td>
    </tr>
    <tr>
        <td>Db User</td>
        <td><input name="Db_User" /></td>
    </tr>
    <tr>
        <td>Db Pass</td>
        <td><input name="Db_Pass" type="password" /></td>
    </tr>
    <tr>
        <td>File Path</td>
        <td><input name="File_Path" /></td>
    </tr>
    <tr>
        <td></td>
        <td><input type="submit" value="Install" /></td>
    </tr>
</table>
</form>